#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	char s[20];
	for(int i = 0; i < n; i++)
	{
		cin >> s;
		if(islower(s[0]))
			s[0] = toupper(s[0]);
		int j = 0;
		while(s[j++])
		{
			if(isupper(s[j]))
				s[j] = tolower(s[j]);
		}
		cout << s << endl;
	}
	return 0;
}
